﻿<phone:PhoneApplicationPage 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:toolbox="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:local="clr-namespace:Nok_Air"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    x:Class="Nok_Air.FlightSchedulePage"
	Foreground="{StaticResource PhoneForegroundBrush}"
	Orientation="Portrait"
	shell:SystemTray.IsVisible="False" FontFamily="/Nok Air;component/Fonts/Fonts.zip#PSL Display" FontSize="40">

    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="flightScheduleItemTemplate">
            <StackPanel Margin="5,10" Width="470">
                <Border Margin="0">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="White"/>
                            <GradientStop Color="#FFFDCA3C" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <TextBlock Text="{Binding Day, Converter={StaticResource DayConverter}}" Foreground="Black" FontSize="42.667" FontWeight="Bold" Margin="10,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                </Border>
                <ListBox Margin="0" ItemsSource="{Binding ScheduleItem}" FontSize="35" Foreground="Black" IsEnabled="False" Padding="20,0,0,0" Background="#99FFFFFF">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                                <Grid Width="420">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="2*"/>
                                        <ColumnDefinition Width="1*"/>
                                        <ColumnDefinition Width="1.5*"/>
                                        <ColumnDefinition Width="1*"/>
                                        <ColumnDefinition Width="1..5*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" TextWrapping="Wrap" Text="{Binding FlightNumber}"/>
                                    <TextBlock Grid.Column="1" TextWrapping="Wrap" Text="{Binding Dep}" Margin="10,0,5,0"/>
                                    <TextBlock Grid.Column="2" TextWrapping="Wrap" Text="{Binding DepartureTime}"/>
                                    <TextBlock Grid.Column="3" TextWrapping="Wrap" Text="{Binding Arr}" Margin="10,0,5,0"/>
                                    <TextBlock Grid.Column="4" TextWrapping="Wrap" Text="{Binding ArrivalTime}"/>
                                </Grid>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </DataTemplate>
        <local:DayConverter x:Key="DayConverter"/>
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent" d:DataContext="{d:DesignData /SampleData/MainViewModelSampleData.xaml}">
        <Grid.RowDefinitions>
            <RowDefinition Height="70"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="80"/>
        </Grid.RowDefinitions>
        <Grid Style="{StaticResource TopAppBarStyle}"  Margin="0">
        	<Grid.Background>
        		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        			<GradientStop Color="#FF464848" Offset="0"/>
        			<GradientStop Color="Black" Offset="0.5"/>
        			<GradientStop Color="#FF101010" Offset="0.49"/>
        			<GradientStop Color="#FF101010" Offset="1"/>
        		</LinearGradientBrush>
        	</Grid.Background>
            <Grid.ColumnDefinitions>
                <ColumnDefinition  Width="1*"/>
                <ColumnDefinition  Width="2*"/>
                <ColumnDefinition  Width="1*"/>
            </Grid.ColumnDefinitions>
            <TextBlock x:Name="Title_Flight_Schedule" Margin="0" Text="{Binding FlightSheduleTitle}" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="48" Foreground="White" Grid.Column="1"/>
            <Button x:Name="doneButton" Content="{Binding Done}" Style="{StaticResource BlueButtonStyle}" Margin="5,0" Click="doneButton_Click" Foreground="White" Grid.Column="2" FontSize="40" VerticalAlignment="Center"/>
        </Grid>
        <Grid Style="{StaticResource ContentStyle}" Margin="0">
            <StackPanel Margin="35,20" Orientation="Vertical" d:LayoutOverrides="Height">
                <StackPanel Margin="0,0,0,5">
                    <TextBlock Text="{Binding From}" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                    <toolkit:ListPicker x:Name="airportScr2" ItemsSource="{Binding AvailableAirportItemsSrc}" Margin="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left"
			ItemTemplate="{StaticResource AirportItemTemplate}" ItemCountThreshold="1" FullModeItemTemplate="{StaticResource AirportFullModeItemTemplate}" CacheMode="BitmapCache" SelectionChanged="airportScr2_SelectionChanged"/>
                </StackPanel>
                <StackPanel Margin="0,0,0,5">
                    <TextBlock Text="{Binding To}" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                    <toolkit:ListPicker x:Name="airportDest2" ItemsSource="{Binding AvailableAirportItemsDest}" Margin="0" HorizontalContentAlignment="Left" ItemTemplate="{StaticResource AirportItemTemplate}" ItemCountThreshold="1" FullModeItemTemplate="{StaticResource AirportFullModeItemTemplate}" CacheMode="BitmapCache"/>
                </StackPanel>
                <StackPanel>
                    <TextBlock x:Name="date" TextWrapping="Wrap" HorizontalAlignment="Left"  Foreground="White" TextAlignment="left" VerticalAlignment="Center" Text="{Binding Date}" d:LayoutOverrides="HorizontalAlignment"/>
                    <toolbox:DatePicker x:Name="dateFlight" ValueChanged="dateFlight_ValueChanged" ValueStringFormat="{}{0:dd/MM/yyyy}" VerticalAlignment="Center" Margin="-12,-8,-12,0" Foreground="Black" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="12"/>
                </StackPanel>
                <Button x:Name="viewButton" Content="{Binding View}" Background="{x:Null}" VerticalAlignment="Top" BorderThickness="3" HorizontalAlignment="Left" Style="{StaticResource BlackButtonStyle}" Width="170" Height="72" Foreground="White" BorderBrush="{x:Null}" Click="viewButton_Click" FontSize="40" Margin="120,0,0,0"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="2">
            <local:AppBarMenuUserControl/>
        </Grid>
        <Grid x:Name="ScheduleLayout" Grid.Row="0" Grid.RowSpan="3" Visibility="Collapsed">
        	<Grid.RowDefinitions>
        		<RowDefinition Height="Auto"/>
        		<RowDefinition/>
        		<RowDefinition Height="Auto"/>
        	</Grid.RowDefinitions>
        	<Grid.Background>
                <ImageBrush Stretch="Fill" ImageSource="/Images/Background/FlightScheduleResultBG.png"/>
        	</Grid.Background>
        	<Grid Height="100" VerticalAlignment="Top">
        		<Grid.ColumnDefinitions>
        			<ColumnDefinition/>
        			<ColumnDefinition Width="5*"/>
        		</Grid.ColumnDefinitions>
        		<Grid.RowDefinitions>
        			<RowDefinition/>
        			<RowDefinition/>
        		</Grid.RowDefinitions>
        		<TextBlock x:Name="fromtxt" HorizontalAlignment="Right" TextWrapping="Wrap" Text="{Binding From}" VerticalAlignment="Top" Margin="0,0,10,0"/>
        		<TextBlock x:Name="totxt" HorizontalAlignment="Right" TextWrapping="Wrap" Text="{Binding To}" VerticalAlignment="Top" Grid.Row="1" Margin="0,0,10,0"/>
        		<TextBlock x:Name="from" TextWrapping="Wrap" Text="{Binding SelectedItem.AirPortName, ElementName=airportScr2}" d:LayoutOverrides="Width, Height" Grid.Column="1"/>
        		<TextBlock x:Name="to" TextWrapping="Wrap" Text="{Binding SelectedItem.AirPortName, ElementName=airportDest2}" d:LayoutOverrides="Width, Height" Grid.Column="1" Grid.Row="1"/>
        	</Grid>
        	<ListBox x:Name="flightScheduleListBox" ItemsSource="{Binding ScheduleItems}" Visibility="Visible" Width="470" HorizontalAlignment="Center" ItemTemplate="{StaticResource flightScheduleItemTemplate}" Grid.Row="1" Margin="10,0"/>
        	<Button Content="{Binding OK}" Height="66" Margin="0,5,0,10" Style="{StaticResource BlueButtonStyle}" VerticalAlignment="Center" Width="150" Click="OK_Click" FontSize="48" FontWeight="Bold" Grid.Row="2" HorizontalAlignment="Center" />
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>

		